package com.hy.example.shared.autoconfigure.common;

import com.hy.example.shared.exception.DefaultExceptionHandler;
import com.hy.example.shared.exception.DefaultExceptionHandler;
import com.hy.example.shared.exception.DefaultExceptionHandler;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConditionalOnWebApplication
class WebMVCConfiguration {
  @Bean
  @ConditionalOnMissingBean
  @ConditionalOnWebApplication
  @ConditionalOnMissingClass("feign.codec.Decoder")
  public DefaultExceptionHandler defaultExceptionHandler() {
    return new DefaultExceptionHandler();
  }
}
